package org.forex.impl.engine;

import static org.junit.Assert.*;

import java.io.IOException;

import org.forex.impl.ws.GetInstrumentsHistory;
import org.forex.vo.Instrument;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Named;
import org.jbehave.core.annotations.Then;

public class HistorySteps{
	Instrument ins;
	InstrumentHistory insH;
	InstrumentTrend insT;
 
	@Given("the history for an instrument with code $code")
	public void givenIstoryInstrument(@Named("code") String code) throws IOException {
		
		ins=new Instrument();
		ins.setInstrument(code);
		
		insH=new InstrumentHistory(ins);	
		
		new GetInstrumentsHistory().get(ins).ifPresent(h->{
			insH.setCandles(h.getCandles());
		});
		
		assertTrue(insH.getCandles().size()==500);		
	}
	
	@Then("find util trend")
	public void thenFindTrend(){
		insT=new InstrumentTrend();
		
		//String res=insT.findTrend(insH);
		
		//assertNotNull(res);
		//TODO
	}
	
}